<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
        public function __construct($self) {
        	echo "teste01 - sergBootstrap";
        	parent::__construct($self);
        	Zend_Loader::loadClass('Zend_Controller_Front');
        	Zend_Loader::loadClass('Zend_Config_Ini');
        	
        	Zend_Loader::loadClass('BaseController');
        	Zend_Loader::loadClass('StringFormat');
        	/*
        	Zend_Loader::loadClass('Zend_Registry');
        	Zend_Loader::loadClass('Zend_Db');
        	Zend_Loader::loadClass('Zend_Db_Table');
        	Zend_Loader::loadClass('Zend_Auth');
        	Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
        	Zend_Loader::loadClass('Zend_Form');
        	Zend_Loader::loadClass('Zend_Form_Element_Text');
        	Zend_Loader::loadClass('Zend_Form_Element_Password');
        	Zend_Loader::loadClass('Zend_Form_Element_Submit');
        	Zend_Loader::loadClass('Zend_Form_Element_Select');
        	Zend_Loader::loadClass('Zend_Form_Element_Image');
        	Zend_loader::loadClass('Zend_Filter_Alpha');
        	Zend_Loader::loadClass('Zend_Filter_StripTags');
        	Zend_Loader::loadClass('Zend_Filter_StringTrim');
        	Zend_Loader::loadClass('Zend_Controller_Action');
        	Zend_loader::loadClass('Zend_Mail');
        	Zend_loader::loadClass('Zend_Mail_Transport_Smtp');
        	Zend_loader::loadClass('Zend_Filter_Alpha');
        	Zend_Loader::loadClass('Zend_Translate');
        	Zend_Loader::loadClass('Zend_File_Transfer_Adapter_Http');
        	Zend_Loader::loadClass('Zend_File_Transfer');
        	*/
        }

        protected function _initConnection(){
        	$options = $this->getOption('resources');
            $db_adapter = $options['db']['adapter'];
            $params     = $options['db']['params'];

            try{
                $db = Zend_Db::factory($db_adapter, $params);
                $db->getConnection();

                // Registra a $db para que se torne acess�vel em toda app
                $registry = Zend_Registry::getInstance();
                $registry->set('db', $db);

            }catch( Zend_Exception $e){
                echo "Estamos sem conexão ao banco de dados neste momento. Tente mais tarde por favor.";
                exit;
            }
        }


}

